<?php 
require_once('./system/dbConn.php');
require_once('./system/myFunc.php');
connect();
if(!empty($_FILES["pic"]["name"])){
	$pic=uploadfile('pic',UserPhotoPath,array('jpg','gif','png'));
}
else{
	$pic='';
}
$data=array(
	'uname'=>trim($_POST['uname']),
	'password'=>$_POST['password'],
	'gender'=>$_POST['gender'],
	'birthdate'=>$_POST['birthdate'],
	'hobby'=>implode($_POST['hobby'],','),
	'degree'=>$_POST['degree'],
	'intro'=>$_POST['intro'],
	'pic'=>$pic
	);
$result=add('users',$data);
if(!$result){
	echo "注册失败！<br/>";
	echo "<a href='userReg.html'>返回</a>";
}
else{
	echo "注册成功！<br/>";
	echo "<a href='./admin/login.html'>管理员登录</a>查看用户信息,";
	echo "或返回<a href='userReg.html'>注册<a/>页面！";
}

 ?>